" let键变空格
let mapleader=" "
" 高亮
syntax on
" 显示行号
set number
" 显示相对行号
set relativenumber
" 当前行显示一条线
set cursorline
" 字超出行长自动换行
set wrap
" 显示当前按下按键
set showcmd
" 可选择项目
set wildmenu

" 搜索按确定后高亮
set hlsearch
" 运行不高亮
exec "nohlsearch"
" 一边输入一边高亮
set incsearch
" 忽略大小写搜索
set ignorecase
" 智能搜索
set smartcase

set nocompatible
filetype on
filetype indent on
filetype plugin on
filetype plugin indent on
set mouse=a
set encoding=utf-8
set expandtab
set tabstop=2
set shiftwidth=2
set softtabstop=2
set list
set listchars=tab:▸\ ,trail:▫
set scrolloff=5
set tw=0
set indentexpr=
set backspace=indent,eol,start
set foldmethod=indent
set foldlevel=99
set laststatus=2
set autochdir
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif

exec "nohlsearch"
" 移动到到下一条搜索信息
noremap = nzz
" 移动到到上一条搜索信息
noremap - Nzz
" 空格加回车输出	
noremap <LEADER><CR> :nohlsearch<CR>

" 分屏操作
map si :set splitright<CR>:vsplit<CR>
map sn :set nosplitright<CR>:vsplit<CR>
map su :set nosplitbelow<CR>:split<CR>
map se :set splitbelow<CR>:split<CR>

"
map <LEADER>i <C-w>l
map <LEADER>u <C-w>k
map <LEADER>n <C-w>h
map <LEADER>e <C-w>j

" 分屏后拖
map <up> :res +5<CR>
map <down> :res -5<CR>
map <left> :vertical resize-5<CR>
map <right> :vertical resize+5<CR>

" 创建新文件
map tu :tabe<CR>
" Move around tabs with tn and ti
map tn :-tabnext<CR>
map ti :+tabnext<CR>
" Move the tabs with tmn and tmi
map tmn :-tabmove<CR>
map tmi :+tabmove<CR>

"	水平分屏换垂直
map sv <C-w>t<C-w>H
map sh <C-w>t<C-w>K

" 移动键映射
noremap n h
noremap u k
noremap e j
noremap i l
noremap U 5k
noremap E 5j

" 更快的在线导航
noremap W 5w
noremap B 5b
" set h (same as n, cursor left) to 'end of word'
noremap h e

" N key: go to the start of the line
noremap N 0
" I key: go to the end of the line
noremap I $

" 按Ctrl U或E将在不移动光标的情况下向上/向下移动视图端口
noremap <C-U> 5<C-y>
noremap <C-E> 5<C-e>
inoremap <C-U> <Esc>5<C-y>a
inoremap <C-E> <Esc>5<C-e>a

" 窗口管理
map <LEADER>w <C-w>w
map <LEADER>u <C-w>k
map <LEADER>e <C-w>j
map <LEADER>n <C-w>h
map <LEADER>i <C-w>l



" 自动补全选择
inoremap <C-i> <C-p>

" 插入模式
noremap k i
noremap K I

" 撤销
noremap l u

" 插入模式下撤销
inoremap <C-z> <C-u>


" Others
map <LEADER>o o<Esc>u

" 没有映射
map s <nop>
" 保存
map S :w<cr>
" 退出
map Q :q<cr>
" 重新加载文件
map R :source $MYVIMRC<CR>

" Column (:) mods
map ; :
map q; q:

map <LEADER>v  tu:e $MYVIMRC<CR>

" 不加载default.vim文件
let skip_defaults_vim=""

